#!/bin/sh
# This regression test is a part of SIPp.
# A copy of the ACK that arrives after the BYE (sent for a retransmitted
# 200) must be absorbed, not fail the UAS's call as unexpected.
. "`dirname "$0"`/../functions"; init

sippfg -sn uas -i 127.0.0.1 -p 5070 -m 1 -timeout 10 -timeout_error \
    >/dev/null 2>&1 &
uas=$!
sleep 1
sippfg -sf uac.xml -i 127.0.0.1 -p 5071 -m 1 127.0.0.1:5070 \
    -timeout 6 -timeout_error >/dev/null 2>&1
uac_status=$?
wait $uas
uas_status=$?

if test $uac_status -ne 0; then
    fail "UAC failed with $uac_status"
elif test $uas_status -ne 0; then
    fail "UAS failed with $uas_status on the second ACK"
else
    ok
fi
